import random
import time

import requests
from fake_useragent import UserAgent

headers = {
    'upgrade-insecure-requests': '1',
    'cookie': 'wd_guid=2c19bb21-870f-457e-9289-21e8ba7d971d; historyState=state; __zp_seo_uuid__=56e8381c-aa73-4558-bde7-89dcf06087a0; __g=-; Hm_lvt_194df3105ad7148dcf2b98a91b5e727a=1689687866; lastCity=101250100; _bl_uid=O4lLFkIt88vcwhk5di9jezbsmXUj; Hm_lpvt_194df3105ad7148dcf2b98a91b5e727a=1689688226; __c=1689687866; __l=r=https%3A%2F%2Fcn.bing.com%2F&l=%2Fwww.zhipin.com%2Fweb%2Fgeek%2Fjob%3Fcity%3D101250100%26position%3D100901&s=3&g=&friend_source=0&s=3&friend_source=0; __a=92494580.1654171322.1669382168.1689687866.58.7.14.58; __zp_stoken__=83bfeExVSQVIECTwwADdNHgRuVicVYD1hIQ4%2BSmBtOQJ5SUYReUsjUAwQMlRAb1YURm8aE0Bbe1UhGGI5DEd%2FVXwaaRscZXlrIh8eL0trWRNADVN2Y349fwUJJHQ2dlJEAmUGfwl%2FdiZgGBR%2BUARCbBVwBzgPNTFpQRV4YnQRFjV5DxYbNS8OMAAnRz90T2A%2FBmx2A0tlLA%3D%3D; __zp_sseed__=T05xNSm1KKkEx5GTtcCo3CSZYSiY3FnC/5xvZaHE1Se2zL0/N1+/jhHycnzLuqRKTyd8AhJv869BpeO3xNZ7ug==; __zp_sname__=b6ecb702; __zp_sts__=1689689534123'
}


def get_data(link):
    headers['user-agent'] = UserAgent().random
    res = requests.get(link, headers=headers)

    print(link)


if __name__ == '__main__':
    i = 1
    while i < 10:
        url = 'https://www.zhipin.com/wapi/zpgeek/search/joblist.json?scene=1&query=&city=101250100&experience' \
              '=&payType=&partTime=&degree=&industry=&scale=&stage=&position=100901&jobType=&salary' \
              '=&multiBusinessDistrict=&multiSubway=&page={}&pageSize=30'.format(
            i)

        i += 1
        get_data(url)
        time.sleep(random.randint(15, 30))
